package com.object;

import java.util.Random;

/**
 * @author xiangui
 * 描述:
 * 时间: Create in 10:02 2018/7/20
 */

class Initable{
    static final int staticFinal = 47;
    static final int staticFinal1 = ClassInitialization.random.nextInt(1000);
    static {
        System.out.println("Initializing initable");
    }
}

class Initable1{
    static final int staticNonFinal = 147;
    static {
        System.out.println("Initializing Initable2");
    }
}

class Initable3{
    static final int staticNonFinal = 74;
    static {
        System.out.println("Initializing Initable3");
    }
}

public class ClassInitialization {

    public static Random random = new Random(47);

    public static void main(String[] args) throws ClassNotFoundException {
        Class initable = Initable.class;
        System.out.println("After creating Initable ref");
        System.out.println(Initable.staticFinal);
        System.out.println(Initable.staticFinal1);
        System.out.println(Initable1.staticNonFinal);
        Class initable3 = Class.forName("com.object.Initable3");
        System.out.println("After creating Initable3 ref");
        System.out.println(Initable3.staticNonFinal);
    }

}
